home *** CD-ROM | disk | FTP | other *** search
Wrap
global gHotRects, gObjects, sQTCharSprite, gHaveNavs, gCPU, gTimerList, gSoundchannels on setupG11D if getaProp(getaProp(gStates, #BeenThere), #G11D) = 0 then set newAccountBalance to getaProp(getaProp(gObjects, #LongTermStock), #ProsperoAccountBalance) MakeDynamic(#LongTermStock, #AccountBalance, newAccountBalance) end if if (getaProp(getaProp(gObjects, #LongKeyBoard), #keyTargetState) = #stockEntry) and (getaProp(getaProp(gObjects, #LongTermStock), #InfoKFJump) = #false) then resetGTextFields() put string(getaProp(getaProp(gObjects, #LongTermStock), #validPIN)) into field "G11LPINDisplay.txt" put "$" && string(getaProp(getaProp(gObjects, #LongTermStock), #AccountBalance)) into field "G11LBalanceDisplay.txt" reLoadCompanyFields() set companyButtonDown to getaProp(getaProp(gObjects, #LongStocks), #currentChildDown) if companyButtonDown <> #none then AddObjects([#LFractalAnalysisHRect, #LFractalStatisticHRect]) showCompanyDisplays() end if end if set companyButtonDown to getaProp(getaProp(gObjects, #LongStocks), #currentChildDown) if companyButtonDown <> #none then set companyObjDown to getaProp(gObjects, companyButtonDown) MakeDynamic(companyButtonDown, #DisplayState, #down) if voidp(getaProp(gHotRects, #LFractalAnalysisHRec)) then AddObjects([#LFractalAnalysisHRect, #LFractalStatisticHRect]) end if end if end on setupG11F DoLInfoPersistenceHRect() end on reLoadCompanyFields set companyList to getaProp(getaProp(gObjects, #LongStocks), #Children) repeat with companyRef in companyList set companyObj to getaProp(gObjects, companyRef) set months to getaProp(companyObj, #monthsEntered) set dataRef to getAt(getaProp(companyObj, #Children), 1) set dataField to getaProp(getaProp(getaProp(gObjects, dataRef), #cast), #INIT) if integerp(months) then put string(months) into field dataField end if end repeat end on clearStockEntries set companyList to getaProp(getaProp(gObjects, #LongStocks), #Children) repeat with companyRef in companyList set companyObj to getaProp(gObjects, companyRef) MakeDynamic(companyRef, #monthsEntered, #none) set dataRef to getAt(getaProp(companyObj, #Children), 1) set dataField to getaProp(getaProp(getaProp(gObjects, dataRef), #cast), #INIT) put " " into field dataField end repeat end on cleanupG11D DelObjects([#LFractalAnalysisHRect, #LFractalStatisticHRect]) if getaProp(getaProp(gObjects, #LongTermStock), #InfoKFJump) = #false then DelObjects([#LongBalanceDisplay, #LongPINDisplay, #LStocMHdata, #LStocORdata, #LStocMIdata, #LStocATdata, #LStocHAdata]) clearGTextFields() setLongKeyBoardState(#on) set companyButtonDown to getaProp(getaProp(gObjects, #LongTermStock), #companySelected) if companyButtonDown <> #none then MakeDynamic(companyButtonDown, #DisplayState, #UP) end if MakeDynamic(#LongRunGroup, #lastButtonClicked, #none) MakeDynamic(#LongTermStock, #companySelected, #none) MakeDynamic(#LongTermStock, #pinEntries, 0) MakeDynamic(#LongStocks, #currentChildDown, #none) MakeDynamic(#LongTermStock, #enteredPIN, #none) MakeDynamic(#LongTermStock, #keyTargetState, #PINEntry) MakeDynamic(#LongTermStock, #stocksRun, []) MakeDynamic(#LongKeyBoard, #keyTargetState, #PINEntry) MakeDynamic(#LongKeyBoard, #dataEntryState, #newEntry) setaProp(getaProp(getaProp(gObjects, #LongFeedback), #cast), #INIT, the number of cast "G11EPIN.PCT") setaProp(getaProp(getaProp(gObjects, #LongFractalGraph), #cast), #INIT, the number of cast "G11DGraphDummy") setaProp(getaProp(getaProp(gObjects, #LongFractalInfo), #cast), #INIT, the number of cast "cNullSprite") end if setaProp(getaProp(gObjects, #LongTermStock), #InfoKFJump, #false) end on DoLongInfo setaProp(getaProp(gObjects, #LongTermStock), #InfoKFJump, #true) Jumptokey(#G11F) end on DoLongStockKeyPad KeyNum if getaProp(getaProp(gObjects, #LongKeyBoard), #keyTargetState) = #PINEntry then set currentPIN to getLongPINDisplayValue() if integerp(KeyNum) then if getLongKeyBoardState() = #on then if field "G11LPINDisplay.txt" = " " then put string(KeyNum) into field "G11LPINDisplay.txt" else put string(KeyNum) after field "G11LPINDisplay.txt" end if if the number of chars in field "G11LPINDisplay.txt" = 4 then setLongKeyBoardState(#enterPIN) end if end if else if KeyNum = #return then if currentPIN = getaProp(getaProp(gObjects, #LongTermStock), #validPIN) then doValidLongPIN() else doInValidLongPIN() end if end if end if else if (getaProp(getaProp(gObjects, #LongKeyBoard), #keyTargetState) = #stockEntry) and (KeyNum <> #return) then set companyRef to getaProp(getaProp(gObjects, #LongStocks), #currentChildDown) if companyRef <> #none then set hotfield to getHotFieldCastNum(companyRef) if not integerp(value(field hotfield)) or (getaProp(getaProp(gObjects, #LongKeyBoard), #dataEntryState) = #newEntry) then put " " into field hotfield MakeDynamic(#LongKeyBoard, #dataEntryState, #inProgress) end if if field hotfield = " " then put string(KeyNum) into field hotfield else put string(KeyNum) after item 1 of field hotfield end if MakeDynamic(companyRef, #monthsEntered, integer(field hotfield)) if the number of chars in field hotfield = 3 then setLongKeyBoardState(#off) end if end if end if end if end on getHotFieldCastNum inCompanyRef set hotFieldName to "G11" & string(inCompanyRef) & "data.txt" return the number of cast hotFieldName end on getLongPINDisplayValue set pinCastNum to the number of cast "G11LPINDisplay.txt" set pinDisplayValue to value(field "G11LPINDisplay.txt") return pinDisplayValue end on doValidLongPIN MakeDynamic(#LongTermStock, #enteredPIN, #valid) playSound("G11ent.aif", #keyframeCast) MakeDynamic(#LongKeyBoard, #keyTargetState, #stockEntry) MakeDynamic(#LongKeyBoard, #State, #on) set currentAccountBalance to getaProp(getaProp(gObjects, #LongTermStock), #AccountBalance) put "$" && string(currentAccountBalance) into field "G11LBalanceDisplay.txt" displayLongFeedback("cNullSprite") setaProp(getaProp(getaProp(gObjects, #LongFeedback), #cast), #INIT, the number of cast "cNullSprite") updateStage() end on doInValidLongPIN MakeDynamic(#LongTermStock, #enteredPIN, #none) set currentPINEntries to getaProp(getaProp(gObjects, #LongTermStock), #pinEntries) set currentPINEntries to currentPINEntries + 1 MakeDynamic(#LongTermStock, #pinEntries, currentPINEntries) if (getLongPINDisplayValue() = getaProp(getaProp(gObjects, #LongTermStock), #shortPIN)) and (currentPINEntries < 3) then put " " into field "G11LPINDisplay.txt" displayLongFeedback("G11E_NO.PCT") Startthetimer(3 * 60, "jumptoKey (#G11A)") else put " " into field "G11LPINDisplay.txt" MakeDynamic(#LongTermStock, #enteredPIN, #invalid) playSound("G11abort.aif", #keyframeCast) displayLongFeedback("G11EINV.PCT") updateStage() CountGTime(3) displayLongFeedback("G11EPIN.PCT") setLongKeyBoardState(#on) end if if currentPINEntries = 3 then doGEndGame() end if end on displayLongFeedback inCastName set feedbackCastNum to the number of cast inCastName set longFeedBackSprite to getaProp(getaProp(gObjects, #LongFeedback), #SpriteNum) set the castNum of sprite longFeedBackSprite to feedbackCastNum updateStage() end on setLongKeyBoardState inState if symbolp(inState) then MakeDynamic(#LongKeyBoard, #State, inState) else put "bad parameter passed to setShortKeyBoardState" end if end on getLongKeyBoardState set kBoardOList to getaProp(gObjects, #LongKeyBoard) set keyBoardState to getaProp(kBoardOList, #State) return keyBoardState end on DoLCompanySelectKeyPad companySelected if voidp(getaProp(gHotRects, #LFractalAnalysisHRec)) then AddObjects([#LFractalAnalysisHRect, #LFractalStatisticHRect]) end if showCompanyDisplays() if getLongKeyBoardState() <> #enterPIN then MakeDynamic(#LongKeyBoard, #State, #on) MakeDynamic(#LongKeyBoard, #dataEntryState, #newEntry) end if MakeDynamic(#LongTermStock, #companySelected, getaProp(getaProp(gObjects, #LongStocks), #currentChildDown)) end on showCompanyDisplays set companyRef to getaProp(getaProp(gObjects, #LongStocks), #currentChildDown) if getaProp(getaProp(gObjects, #LFractalAnalysisHRect), #State) = #selected then set infoRef to #LFractalAnalysisHRect else if getaProp(getaProp(gObjects, #LFractalStatisticHRect), #State) = #selected then set infoRef to #LFractalStatisticHRect else set infoRef to #LFractalAnalysisHRect end if end if set infoSpriteNum to getaProp(getaProp(gObjects, #LongFractalInfo), #SpriteNum) set graphSpriteNum to getaProp(getaProp(gObjects, #LongFractalGraph), #SpriteNum) set infoDisplayCastNum to getaProp(getaProp(getaProp(getaProp(getaProp(gObjects, #LongFractalInfo), #cast), #displayAssigns), companyRef), infoRef) set graphDisplayCastNum to getaProp(getaProp(getaProp(getaProp(getaProp(gObjects, #LongFractalGraph), #cast), #displayAssigns), companyRef), infoRef) set the castNum of sprite infoSpriteNum to infoDisplayCastNum set the castNum of sprite graphSpriteNum to graphDisplayCastNum setaProp(getaProp(getaProp(gObjects, #LongFractalGraph), #cast), #INIT, graphDisplayCastNum) setaProp(getaProp(getaProp(gObjects, #LongFractalInfo), #cast), #INIT, infoDisplayCastNum) updateStage() end on DoLFractalAnalysisHRect MakeDynamic(#LFractalAnalysisHRect, #State, #selected) MakeDynamic(#LFractalStatisticHRect, #State, #notSelected) showCompanyDisplays() end on DoLFractalStatisticHRect MakeDynamic(#LFractalStatisticHRect, #State, #selected) MakeDynamic(#LFractalAnalysisHRect, #State, #notSelected) showCompanyDisplays() end on DoLongRun if getaProp(getaProp(gObjects, #LongTermStock), #enteredPIN) <> #valid then flashFeedback() else set runSoundChannel to playSound("G11run.aif", #keyframeCast) if gCPU = #mpc then set myTimer to the ticks repeat while the ticks < (myTimer + 15) CursorandUpdate() end repeat end if repeat while soundBusy(runSoundChannel) if the mouseDown then if inside(point(the mouseH, the mouseV), rect(174, 31, 265, 62)) then exit end if end if CursorandUpdate() end repeat calcProfit() end if MakeDynamic(#LongRunGroup, #lastButtonClicked, #LongRun) end on findSoundChannel soundName if not voidp(gSoundchannels) then repeat with i = 1 to count(gSoundchannels) set channelNum to getPropAt(gSoundchannels, i) set channelInfo to getaProp(gSoundchannels, channelNum) if getaProp(channelInfo, #name) = soundName then return channelNum end if end repeat end if return 0 end on DoLongAbort if getaProp(getaProp(gObjects, #LongTermStock), #enteredPIN) <> #valid then flashFeedback() else clearStockEntries() end if MakeDynamic(#LongRunGroup, #lastButtonClicked, #LongAbort) end on DoLongStatus if getaProp(getaProp(gObjects, #LongTermStock), #enteredPIN) <> #valid then flashFeedback() else if getaProp(getaProp(gObjects, #LongRunGroup), #lastButtonClicked) = #LongRun then set answerStatus to checkAnswers() displayStatusMessages(answerStatus) if answerStatus = #correct then MakeDynamic(#LongTermStock, #solved, #true) setaProp(getaProp(gStates, #Conditions), #LongStock, #true) end if end if end if setaProp(getaProp(gObjects, #LongRunGroup), #lastButtonClicked, #LongStatus) end on flashFeedback set longFeedBackSprite to getaProp(getaProp(gObjects, #LongFeedback), #SpriteNum) repeat with i = 1 to 3 CountGTime(0.5) set the type of sprite longFeedBackSprite to 0 updateStage() CountGTime(0.5) set the type of sprite longFeedBackSprite to 1 updateStage() end repeat end on calcProfit set monthsMH to value(field "G11LStocMHdata.txt") set monthsOR to value(field "G11LStocORdata.txt") set monthsMI to value(field "G11LStocMIdata.txt") set monthsAT to value(field "G11LStocATdata.txt") set monthsHA to value(field "G11LStocHAdata.txt") set newStocksRun to getaProp(getaProp(gObjects, #LongTermStock), #stocksRun) set newAccountBalance to getaProp(getaProp(gObjects, #LongTermStock), #AccountBalance) if getOne(newStocksRun, #LstocMH) = 0 then set ProfitMH to monthsMH / 5 * -1 * 20 * (1 - 0.16389999999999999) set newAccountBalance to newAccountBalance + ProfitMH add(newStocksRun, #LstocMH) end if if (getOne(newStocksRun, #LstocOR) = 0) and (monthsOR = 78) then set ProfitOR to 78 * 10 * 0.76379999999999992 set newAccountBalance to newAccountBalance + ProfitOR add(newStocksRun, #LstocOR) end if if (getOne(newStocksRun, #LstocMI) = 0) and (monthsMI = 50) then set ProfitMI to 50 * 5 * 0.72009999999999996 set newAccountBalance to newAccountBalance + ProfitMI add(newStocksRun, #LstocMI) end if if (getOne(newStocksRun, #LstocAT) = 0) and (monthsAT > 0) and (monthsAT < 95) then set ProfitAT to power(-1, random(10)) * 15 * 0.84749999999999992 * monthsAT set newAccountBalance to newAccountBalance + ProfitAT add(newStocksRun, #LstocAT) end if if (getOne(newStocksRun, #LstocHA) = 0) and (monthsHA = 25) then set ProfitHA to 25 * 2 * 0.61739999999999995 set newAccountBalance to newAccountBalance + ProfitHA add(newStocksRun, #LstocHA) end if if checkAnswers() = #correct then set newAccountBalance to 20000000 end if MakeDynamic(#LongTermStock, #stocksRun, newStocksRun) put "$" && integer(newAccountBalance) into field "G11LBalanceDisplay.txt" MakeDynamic(#LongTermStock, #AccountBalance, integer(newAccountBalance)) end on displayStatusMessages answerStatus set statusMessageSpriteNum to getaProp(getaProp(gObjects, #LongStatusFeedback), #SpriteNum) if answerStatus = #incorrect then set firstMessageCastNum to the number of cast "G11E_N01.PCT" set the castNum of sprite statusMessageSpriteNum to firstMessageCastNum + random(10) updateStage() else if answerStatus = #correct then playSound("G11statG.aif", #keyframeCast) set firstMessageCastNum to the number of cast "G11E_Y01.PCT" repeat with i = 0 to 3 set the castNum of sprite statusMessageSpriteNum to firstMessageCastNum + i CountGTime(2) updateStage() end repeat end if end if end on checkAnswers if (value(field "G11LStocMHdata.txt") = 0) and (value(field "G11LStocORdata.txt") = 78) and (value(field "G11LStocMIdata.txt") = 50) and (value(field "G11LStocHAdata.txt") = 25) then return #correct else return #incorrect end if end on DoLongInfoReturn Jumptokey(#G11D) end on DoLInfoPersistenceHRect MakeDynamic(#LongTermStockInfo, #textSelected, #LInfoPersistenceHRect) setLongInfoDisplays() end on DoLInfoRandomHRect MakeDynamic(#LongTermStockInfo, #textSelected, #LInfoRandomHRect) setLongInfoDisplays() end on DoLInfoAntiPersistenceHRect MakeDynamic(#LongTermStockInfo, #textSelected, #LInfoAntiPersistenceHRect) setLongInfoDisplays() end on DoLInfoFractalAnalysisHRect MakeDynamic(#LongTermStockInfo, #graphSelected, #LInfoFractalAnalysisHRect) setLongInfoDisplays() end on DoLInfoFractalStatisticHRect MakeDynamic(#LongTermStockInfo, #graphSelected, #LInfoFractalStatisticHRect) setLongInfoDisplays() end on setLongInfoDisplays set textInfoSpriteNum to getaProp(getaProp(gObjects, #LongTextDisplayInfo), #SpriteNum) set graphInfoSpriteNum to getaProp(getaProp(gObjects, #LongGraphDisplayInfo), #SpriteNum) set textInfo to getaProp(getaProp(gObjects, #LongTermStockInfo), #textSelected) set graphInfo to getaProp(getaProp(gObjects, #LongTermStockInfo), #graphSelected) set textInfoDisplayCastNum to getaProp(getaProp(getaProp(getaProp(getaProp(gObjects, #LongTextDisplayInfo), #cast), #displayAssigns), textInfo), graphInfo) set graphInfoDisplayCastNum to getaProp(getaProp(getaProp(getaProp(getaProp(gObjects, #LongGraphDisplayInfo), #cast), #displayAssigns), textInfo), graphInfo) set the castNum of sprite textInfoSpriteNum to textInfoDisplayCastNum set the castNum of sprite graphInfoSpriteNum to graphInfoDisplayCastNum updateStage() end on DoLongLogoff Jumptokey(#G11a) end on cleanupG11F MakeDynamic(#LongTermStockInfo, #textSelected, #LInfoPersistenceHRect) MakeDynamic(#LongTermStockInfo, #textSelected, #LInfoFractalAnalysisHRect) end